package string;

public class yuming {
    public static void main(String[] args) {
        String s1="http://www.tedu.cn";
        String s2="www.tarena.com.cn";
        String n1=getHostName(s1);
        String n2=getHostName(s2);
        System.out.println(n1);
        System.out.println(n2);
    }
    public static String getHostName(String url){
        int index=url.indexOf(".");
        int index1=url.indexOf(".",index+1);
        if(index!=-1&&index1!=-1){
            return url.substring(index+1,index1);
        }
        return null;
    }
}
